package com.lu.controller;


import com.lu.pojo.Types;
import com.lu.service.TypesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
public class TypesController {
    @Autowired
    private TypesService typesService;
    @RequestMapping(value = "/getTypes" ,method = RequestMethod.GET)
    @ResponseBody
    public List<Types> getAll(){
        List<Types> tttt = typesService.getTypes ( );
        System.out.println (tttt );
        return tttt;

    }
    @RequestMapping(value = "/delete/{tid}" ,method = RequestMethod.GET)
    @ResponseBody
    public int delete(@PathVariable("tid") Integer tid){
        int i = typesService.delTy ( tid );
        System.out.println (i );
        return i;

    }
    @RequestMapping(value = "/addTT" ,method = RequestMethod.GET)
    @ResponseBody
    public int add(@RequestParam( value = "Typess") Types types){
        System.out.println (types );
      int i= typesService.addTy (  types);

       return i;

    }



}
